home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
which5.zoo
/
readme
< prev
next >
Wrap
Text File
|
1992-07-06
|
1KB
|
38 lines
Newsgroups: comp.sources.misc
organization: VU Informatika, Amsterdam, The Netherlands
subject: v11i096: which5
From: maart@cs.vu.nl (Maarten Litmaath)
Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
Posting-number: Volume 11, Issue 96
Submitted-by: maart@cs.vu.nl (Maarten Litmaath)
Archive-name: which5/part01
There was still a small problem with which4. :-(
Thanks go to Jim Meyering <meyering@cs.utexas.edu>, who noted convert() will
clobber the stack if the PATH is longer than BUF_SIZE - 1 characters.
I've changed the use and implementation of convert() altogether: now it
returns a path vector (cf. argv), whose components are the respective
directories in the PATH.
Furthermore I fixed the printing of the PATH: there are no trailing colons
anymore. Now you can do things like:
for dir in `which`
do
set $dir/$pattern
test -f $1 || continue
for i
do
echo $i
done
done
...to find all files in your PATH which match $pattern.
However, beware of rewriting `which' in shell-script! There were good
reasons for making it a C program (check the source).
Thanks for your time,
Maarten Litmaath @ VU Amsterdam:
maart@cs.vu.nl, uunet!mcsun!botter!maart